#define _CRT_SECURE_NO_WARNINGS 1
#pragma once
#include"6.2HashTable.h"
namespace sqy
{
	template<class K, class Hash = HashFunc<K>>
	class unordered_set
	{
	public:
		struct SetKeyOfT
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};
		typedef typename bucket_sqy::HashTable<K, K, Hash, SetKeyOfT>::iterator iterator;
		iterator begin()
		{
			return _ht.begin();
		}
		iterator end() 
		{
			return _ht.end();
		}
		pair<iterator,bool> insert(const K& key)
		{
			return _ht.Insert(key);
		}

	private:
		bucket_sqy::HashTable<K, K, Hash,SetKeyOfT>_ht;

	};
	void Test_set()
	{
		unordered_set<int>hs;
		hs.insert(1);
		hs.insert(3);
		hs.insert(9);
		hs.insert(1);
		hs.insert(5);
		unordered_set<int>::iterator sit = hs.begin();
		while (sit != hs.end())
		{
			cout << *sit << endl;
			++sit;
		}
	}
}